package com.elite.groovy.davco.clink;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.tinet.clink.cc.request.monitor.AgentStatusRequest;
import com.tinet.clink.cc.response.monitor.AgentStatusResponse;
import com.tinet.clink.core.client.Client;
import com.tinet.clink.core.exceptions.ClientException;
import com.tinet.clink.core.exceptions.ServerException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.Arrays;

public class clinkAgentStatus extends AbstractInit {
    private static final Log log = LogFactory.getLog(clinkAgentStatus.class);

    public static String getAgentStatus(Client client, String[] Cnos) throws ServerException, ClientException, JsonProcessingException {
        log.debug("天润操作 AgentStatus-入参 Cnos:" + Arrays.toString(Cnos));

        AgentStatusRequest request = new AgentStatusRequest();
        request.setCnos(Cnos);

        // 座席状态， IDLE：空闲； PAUSE：置忙； WRAPUP：整理； CALLING： 呼叫中； RINGING：响铃； BUSY：通话
        AgentStatusResponse response = client.getResponseModel(request);
        String clinkResult = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(response);
        log.debug("天润返回坐席状态数据:" + clinkResult);

        return clinkResult;

    }

}
